
import React from 'react';
import { View, Text, StyleSheet } from 'react-native';
import * as PropTypes from 'prop-types';
import Loading from './Loading';
import { Metrics, Colors } from '../theme';

export default class EmptyComponent extends React.Component {

    static propTypes = {
        title: PropTypes.string,
        titleStyle: PropTypes.oneOfType([
            PropTypes.number,
            PropTypes.object
        ]),
        style: PropTypes.oneOfType([
            PropTypes.number,
            PropTypes.object
        ]),
        isLoading: PropTypes.bool,
    };

    static defaultProps = {
        title: "暂无数据",
        titleStyle: {},
        style: {},
        isLoading: false,
    };

    constructor(props) {
        super(props);
        this.state = {}
    }

    render() {
        let { title, titleStyle, style, isLoading } = this.props;
        return (
            isLoading ? <Loading /> :
            <View style={[{ alignItems: "center", marginTop: 10 }, style]}>
                <Text allowFontScaling={false} style={[{ fontSize: 15, color: Colors.C2 }, titleStyle]}>{title}</Text>
            </View>
        )
    }
}